<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>抖动效果</title>
    <style>
        html,body{
            height: 100%;
        }
        body{
            background-color: black;
            display: flex;
            justify-content: center;
            align-items: center;
            
        }
        div{
            width: 100px;
            height: 100px;
            background-color: red;
            border-radius: 50%;
            position: relative;
        }
        div:active{
            /*组合式的写法*/
            animation: shake 3s linear;
        }

        @keyframes shake{
            0%{
                left:50px;
            }
            10%{
                top:-50px;
                left:30px;
            }
            20%{
                bottom:30px;
            }
            30%{
                left:-30px;
            }
            40%{
                right:10px;
            }
            50%{
                left:-10px;
            }
            60%{
                left:80px;
            }
            70%{
                top:-60px;
            }
            80%{
                left:10px;
            }
            90%{
                left:-10px;
            }
            100%{
                top:100px;
            }
        }
    </style>
</head>

<body>
    <div>

    </div>
</body>

</html>